package vista;


import java.util.ArrayList;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import modelo.Frase;

@SuppressWarnings("serial")
public class VistaModeloFraseTabla extends AbstractTableModel {

	private static String[] titulos = {"Id", "Frase", "Nivel"};
	private List<Frase> frases = new ArrayList<Frase>();
	
	
	public VistaModeloFraseTabla(List<Frase> frases) {
		super();
		this.frases = frases;
		this.fireTableDataChanged();
	}

	@Override
	public int getColumnCount() {		
		return titulos.length;
	}

	@Override
	public int getRowCount() {		
		return frases.size();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Frase frase = frases.get(rowIndex);
		switch (columnIndex) {
			case 0: return frase.getId();
			case 1: return frase.getDescripcion();
			case 2: return frase.getNivel();
			}
		return null;
	}

	@Override
	public String getColumnName(int column) {
		return titulos[column];
	}

	
}
